import java.util.Calendar;

public class Main {
	/* The Tariffs are subject to change.
	 * Probably yearly, in every April of every year.
	 */
	private static double[] arrTariff1 = {270.6, 16.20,135.3};
	private static double[] arrTariff2 = {220,19.40,110};
	private static double[] arrTariff3 = {177.8,23.60,88.9};
	private static final double constantMetreFactor = 94.9;
	private static double fare = 0.0;
	/*
	 * Remaining part is to check for public holiday dates and
	 * apply the Extra Charges (Telephone Bookings, Heathrow Extra, Christmas and New Year, 
	 * Bank Cards, Soiling)
	 * http://www.tfl.gov.uk/gettingaround/taxisandminicabs/taxis/taxifares/1142.aspx
	 */
	public static void main(String[] args){
		Calendar calendar = Calendar.getInstance();
		int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
		int hourOfDay = calendar.get(Calendar.HOUR_OF_DAY);
		  	
		
		if((dayOfWeek > 1 && dayOfWeek < 7) && (hourOfDay >= 6 && hourOfDay <=20)){
			calcTariff(10760, arrTariff1[0], arrTariff1[1],arrTariff1[2]);
		}else if( ((dayOfWeek > 1 && dayOfWeek < 7) && (hourOfDay > 20 && hourOfDay <=22)) || ((dayOfWeek == 7 || dayOfWeek == 1)) && (hourOfDay >= 6 && hourOfDay <=22)){
			calcTariff(10760,arrTariff2[0], arrTariff2[1],arrTariff2[2]);
		}else if(hourOfDay >= 22 || hourOfDay <= 6){
			calcTariff(10760,arrTariff3[0], arrTariff3[1],arrTariff3[2]);
		}
		System.out.println("The fare is: " + (fare + 2.20));
		
	}
	
	
	/*
	 * The calcTarriff method calculates the fare using the Tariffs defined
	 * above. 
	 */
	public static void calcTariff(double distanceOfRoute, double initialCharge, double rate, double additionalMetre){
	
		double distance = distanceOfRoute;
		//initial charge 
		distance = distance - initialCharge;
		fare = 2.20;
		for(;fare<rate;distance = distance - additionalMetre){
			if(distance > 0){
				   fare = fare + 0.20;
			}else{
				break;
			}
		}
		for(;;distance = distance - constantMetreFactor){
			if(distance >0){
				fare = fare + 0.20;
			}else{
				break;
			}
		}
		
	
	}
	
	
	
	
}
